package cn.touna.jss.modules.custom.carmodel.synctask;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Steve.Tao on 2017/11/21.
 */
public class Counter {
    private Map<String, Integer> map = new HashMap<>();
    private int totalCount = 0;

    public int count(String field) {
        totalCount += 1;
        if (map.containsKey(field)) {
            map.put(field, map.get(field) + 1);
        } else
            map.put(field, 1);
        return map.get(field);
    }

    public int getTotalCount() {
        return totalCount;
    }

    public int getCount(String field) {
        if (map.containsKey(field))
            return map.get(field);
        return 0;
    }
}
